package cn.wolfcode.car.business.query;
import cn.wolfcode.car.common.base.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Calendar;
import java.util.Date;
@Getter
@Setter
public class CustomerVisitQuery extends QueryObject {
    private String visitReason; //拜访原因
    private Integer visitType;  //拜访方式
    //拜访时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;
    //将结束时间往后加一天.可以搜索一天内所有的数据
    public Date getEndTime(){
        Calendar calendar = Calendar.getInstance();
        if (endTime!=null){
            calendar.setTime(endTime);
            calendar.add(Calendar.DAY_OF_WEEK,1);
            return calendar.getTime();
        }else {
            return null;
        }
    }
}